# -*- coding:utf-8 -*-
# Author:Ami
# class People: 经典类 # py2深度继承优先
class People(object):  # 新式类 #py2广度继承优先   py3  都是广度继承优先
    def __init__(self, name, age):
        self.name = name
        self.age = age
        self.friends = []
    def eat(self):
        print("%s is eating..." % self.name)

    def talk(self):
        print("%s is talking..." % self.name)

    def sleep(self):
        print("%s is sleeping..." % self.name)


class Relation(object):
    def make_friends(self, obj):
        print("%s is making friends with %s" % (self.name, obj.name))
        self.friends.append(obj)

class Man(People, Relation):
    def __init__(self, name, age, money):
        # People.__init__(self, name, age)  # 重构构造函数多添加属性
        super(Man, self).__init__(name, age)  # 不用写父类
        self.money = money
        print("%s 一出生就有 %s money" % (self.name, self.money))

    def piao(self):
        print("%s is piaoing.... 20s....done" % self.name)

    def sleep(self):
        People.sleep(self)  # 执行了父类方法，重构父类方法
        print("man is sleeping")


class Woman(People, Relation):
    def get_birth(self):
        print("%s is born a baby...." % self.name)


m1 = Man("Ami", 22, 10)
# m1.eat()
# m1.piao()

w1 = Woman("ami", 26)

m1.make_friends(w1)
w1.name = "adc"
print(m1.friends[0].name)